<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            width: 500px;
            height: 500px;
            background-color: #f00;

            /* 溢出    隐藏 */
            /* 还可以解决margin-top的传递问题 */
            overflow: hidden;
        }

        .a {
            width: 200px;
            height: 700px;
            background-color: #000;
            margin: auto;
            margin-top: 50px;

        }
    </style>
</head>

<body>

    <!-- 
        bug:子元素的margin-top传递到了父元素身上

        解决方案：在父元素身上添加overflow:hidden
     -->

    <div class="box">
        <div class="a"></div>
    </div>

</body>

</html>